#ifndef BABYENGINE_ENGINE_SINGLETON_H__
#define BABYENGINE_ENGINE_SINGLETON_H__

#include "Object.h"
#include "WindowInterface.h"

/**
 * Motor do jogo
 */
class Engine
{
public:

	static Engine& getInstance(void);

	~Engine(void);

	void drawScene(void);


	static int loadTexture( const char* filename );

	bool init( const WindowSettings& settings );
	void startGame(void);

	WindowInterface* getWindow(void);
	Object& getBackground(void);
	Object& addObject(const String& name);
	Object* getObject(const String& name);

	Material* addMaterial(void);
	Material* addMaterial(const char* texture);
	void clearUnusedMaterials(void);


protected:

	 bool hasObjectUsing( Material* mat );

	/// Construtor padrão
	Engine(void);

	Engine(const Engine&);
	Engine& operator=(const Engine&);

	void shutdown(void);

	/// Instância singleton
	static Engine engine;

	WindowInterface* window;
	ILuint imageID;

	std::vector<Object> objetos;
	std::vector<Material*> materiais;
	Object background;
};

#endif /* BABYENGINE_ENGINE_SINGLETON_H__ */
